package gui.navigation;

import gui.MyFrame;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JButton;
import javax.swing.JPanel;


public class D2Gui extends JPanel{
	
	public D2Gui(final MyFrame myFrame){
		this.setLayout(new GridLayout(6, 1));
		this.setPreferredSize(new Dimension(200, 300));
		JButton triangle = new JButton("Triangle");
		triangle.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent e) {
				myFrame.setDataPanel(MyFrame.TRIANGLE);
			}
		});
		this.add(triangle);
		
		JButton quadrangle = new JButton("Quadrangle");
		quadrangle.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent e) {
				myFrame.setDataPanel(MyFrame.QUADRANGLE);
			}
		});
		this.add(quadrangle);
		
		JButton polygon = new JButton("Polygon");
		polygon.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent e) {
				myFrame.setDataPanel(MyFrame.POLYGON);
			}
		});
		this.add(polygon);
		
		JButton circle = new JButton("Circle");
		circle.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent e) {
				myFrame.setDataPanel(MyFrame.CIRCLE);
			}
		});
		this.add(circle);
		
		JButton dist2D = new JButton("<html><center>Distance between 2 points in 2D space</center></html>");
		dist2D.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent e) {
				myFrame.setDataPanel(MyFrame.DIST2D);
			}
		});
		this.add(dist2D);
		
		JButton back = new JButton("Back");
		back.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent e) {
				myFrame.setNavigationPanel(MyFrame.MAIN);
			}
		});
		this.add(back);
	}
}
